package com.jyy.prefabricated.utils;



import org.apache.commons.lang3.StringUtils;

import java.util.Random;


public class OrderUtil {


    /**
     * 生成数据库排序
     * @param ascColumn 需要升序排序的字段，逗号隔开
     * @param descColumn 需要降序排序的字段，逗号隔开
     * @return
     */
    public static String genOrderStr(String ascColumn, String descColumn){
        String orderStr = "";
        if(StringUtils.isNotBlank(descColumn)){
            orderStr = descColumn + " desc";
        }
        if(StringUtils.isNotBlank(orderStr) && StringUtils.isNotBlank(ascColumn)){
            orderStr += ",";
        }
        if(StringUtils.isNotBlank(ascColumn)){
            orderStr += ascColumn;
        }
        return orderStr;
    }


    public static void main(String[] args) {
        System.out.println(genOrderStr("",""));
    }
}
